﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="clr-namespace:AutoCorrelatorGUI.View"
      xmlns:util="clr-namespace:Common.Utility;assembly=Common"
      xmlns:prop="clr-namespace:AutoCorrelatorGUI.Properties"
      x:Class="AutoCorrelatorGUI.View.WellListView" mc:Ignorable="d"
      DataContext="{Binding WellList, Source={StaticResource Locator}}"
      d:DesignHeight="300" d:DesignWidth="158.696" Background="White">
   <UserControl.Resources>
      <util:ColorToBrushConverter x:Key="colorToBrushConverter" />
   </UserControl.Resources>
   <Grid Margin="0" Grid.RowSpan="3">
      <Grid.RowDefinitions>
         <RowDefinition />
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>

      <ListBox ItemsSource="{Binding InternalWellDataView}"
            HorizontalContentAlignment="Stretch" SelectionMode="Extended" AllowDrop="True"
            Margin="10,0,0,2" util:MultiSelect.IsEnabled="True"
            HorizontalAlignment="Left"
            Width="140">
         <ListBox.ItemTemplate>
            <DataTemplate>
               <Grid HorizontalAlignment="Left" Height="Auto" Margin="0,0,0,0"
                     VerticalAlignment="Top" Width="Auto">
                  <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="Auto" />
                     <ColumnDefinition Width="*" />
                  </Grid.ColumnDefinitions>
                  <StackPanel
                        Background="{Binding Color, Converter={StaticResource colorToBrushConverter}}"
                        Margin="0">
                     <CheckBox Content="" IsChecked="{Binding Visible}" Margin="3,2,0,2"
                           Padding="3,0,0,-1" Checked="CheckBox_Checked"
                           Unchecked="CheckBox_Unchecked" />
                  </StackPanel>
                  <TextBlock Text="{Binding Title}" Margin="2,2,2,2" Grid.Column="1"
                        Grid.ColumnSpan="2" />
               </Grid>
            </DataTemplate>
         </ListBox.ItemTemplate>
      </ListBox>
      <Button Content="Select All" Margin="10,3,0,2"
            Command="{Binding SelectAllWellsCommand, Mode=OneWay}"
            HorizontalAlignment="Left" Width="140" Height="20" VerticalAlignment="Top"
            Grid.Row="1" />
      <Button Content="Deselect All" Margin="10,2,0,3"
            Command="{Binding DeSelectAllWellsCommand, Mode=OneWay}"
            HorizontalAlignment="Left" Width="140" Grid.Row="2" />

   </Grid>
</UserControl>
